﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebTraderLite
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

       protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if(this.Page.User.IsInRole("Admin") )
            {
               
                
                NavigationMenu.Items[0].NavigateUrl = "~/AdminContent/AdminHome.aspx"; 
                NavigationMenu.Items[0].Text = "Administration"; 
                MenuItem Brokerfeemenu = new MenuItem();
                Brokerfeemenu.NavigateUrl = "~/AdminContent/AdminBrokerFee.aspx";
                Brokerfeemenu.Text = "Broker Fee Management";
                NavigationMenu.Items.AddAt(1, Brokerfeemenu);
                MenuItem Adminbalance = new MenuItem();
                Adminbalance.Text = "MY Balance";
                Adminbalance.NavigateUrl = "~/AdminContent/AdminAccountBal.aspx";
                NavigationMenu.Items.AddAt(2, Adminbalance);
            }
            else if(this.Page.User.IsInRole("User") )
            {
                MenuItem transMenu = new MenuItem();
                transMenu.Text = "My Transactions";
                transMenu.NavigateUrl = "~/Pages/Transactions.aspx";
                NavigationMenu.Items.AddAt(1, transMenu);
                NavigationMenu.Items[0].NavigateUrl = "~/Home.aspx";

                MenuItem chngpassmenu = new MenuItem();
                chngpassmenu.Text = "Change Password";
                chngpassmenu.NavigateUrl = "~/Account/ChangePassword.aspx";
                NavigationMenu.Items.AddAt(2, chngpassmenu);

                MenuItem accInfo = new MenuItem();
                accInfo.Text = "Account Information";
                accInfo.NavigateUrl = "~/Account/AccountInfo.aspx";
                NavigationMenu.Items.AddAt(3, accInfo);

                MenuItem chngbalance = new MenuItem();
                chngbalance.Text = "Update Balance";
                chngbalance.NavigateUrl = "~/Account/ChangeAccountBal.aspx";
                NavigationMenu.Items.AddAt(4, chngbalance);
                
            }
            
        }
    }
}
